package com.example.photongrid;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.net.Socket;

public class ServerSendingThread implements Runnable{
	ObjectInputStream in;
	ObjectOutputStream out;
	Socket socket;
	ServerSendingThread(Socket s, ObjectInputStream getin, ObjectOutputStream getout){
		socket = s;
		in = getin;
		out = getout;
	}
	public void run(){
		if(StateManagerServer.updateFlag == 1){
			MessageServerToClient servermessage = new MessageServerToClient(StateManagerServer.board, StateManagerServer.vList, StateManagerServer.wList);
			try {
				out.writeObject(servermessage);
				out.flush();
				System.out.println("Message written to output stream");
				StateManagerServer.updateFlag = 0;
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
